package zuoye;

import java.util.Scanner;

public class WorkerTest {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入姓名");
        String ming = sc.nextLine();
        System.out.println("请输入工龄");
        int ling = sc.nextInt();

        Worker worker = new Worker();
        worker.setName(ming);//传回给之前的类
        worker.setYear(ling);

        System.out.println("工人信息如下：");
        System.out.println("姓名："+worker.getName());
        System.out.println("年龄："+worker.getYear());

    }
}
